#!/usr/bin/env python
#coding=utf-8

import httplib, urllib, sys, gzip, StringIO, re

def test(query):  
    
    conn = httplib.HTTPConnection(query)
    
    # Post request
    print "Requesting "+query+"....."
    try:
        fp = open("page.txt",'r')
    except:
        print "Error"
        sys.exit(1)
    content = fp.readlines()
    fp.close()
    print content
    for line in content:
        conn.request("GET", line.strip())
        print "GET "+line.strip()
    
    # Get server response
    print "Waiting for Reponse...\r"
    response = conn.getresponse()
    
    print "Status:%s  Reason: %s" % (response.status, response.reason)
    data = response.read()
    conn.close()

if __name__ == "__main__":
    test(sys.argv[1])